package com.lelv.business.user.action;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.lelv.business.user.bo.IUserCommentBo;
import com.lelv.business.user.model.UserComment;
import com.lelv.framework.action.BaseAction;
import com.lelv.framework.plugin.Page;

public class UserCommentAction extends BaseAction{

	private IUserCommentBo userCommentBo;
	private Page page = new Page();
	private List<UserComment> comments = new ArrayList<UserComment>();
	private UserComment comment = new UserComment();

	public String addUserComment(){

		comment.setCreateTime(new Date());
		this.userCommentBo.addUserComment(comment);

		return SUCCESS;
	}

	public String deleteUserComment(){

		this.userCommentBo.deleteUserComment(comment.getId());

		return SUCCESS;
	}

	public String getUserComments(){

		this.page = this.userCommentBo.getUserComments(page);
		this.comments = page.getList();

		return SUCCESS;
	}

	public Page getPage() {
		return page;
	}

	public void setPage(Page page) {
		this.page = page;
	}

	public List<UserComment> getComments() {
		return comments;
	}

	public void setComments(List<UserComment> comments) {
		this.comments = comments;
	}

	public UserComment getComment() {
		return comment;
	}

	public void setComment(UserComment comment) {
		this.comment = comment;
	}

	public IUserCommentBo getUserCommentBo() {
		return userCommentBo;
	}

	public void setUserCommentBo(IUserCommentBo userCommentBo) {
		this.userCommentBo = userCommentBo;
	}

}
